package com.colin.aiyi.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.colin.aiyi.R;
import com.colin.aiyi.entity.MsgEntity;
import com.colin.aiyi.entity.MyWord;
import com.colin.aiyi.entity.Status;
import com.colin.aiyi.utils.TimeUtil;

import java.util.Date;
import java.util.List;
import java.util.TimerTask;

/**
 * Created by hl on 2017/5/8.
 */

public class MsgAdapter extends BaseQuickAdapter<MsgEntity.ItemsBean, BaseViewHolder> {

    public MsgAdapter(List<MsgEntity.ItemsBean> list) {
        super(R.layout.item_msg, list);
    }

    @Override
    protected void convert(BaseViewHolder helper, MsgEntity.ItemsBean item) {
        if (!item.isDeleted()){
            helper.addOnClickListener(R.id.button_delete);
            helper.addOnClickListener(R.id.msg_root_parent);
            helper.setText(R.id.text_msg_title,item.getTitle());
            helper.setText(R.id.text_msg_time, TimeUtil.getTime(new Date(item.getCreatedDate()),TimeUtil.DATE_FORMAT_DATE));
            helper.setText(R.id.text_msg_desc,item.getContent());
            helper.getView(R.id.text_msg_flag).setVisibility(View.VISIBLE);
            if (item.isIsRead())
            {
                helper.getView(R.id.text_msg_flag).setVisibility(View.GONE);
            }
        }

    }



}